package com.example.sys.job.service;

import com.example.core.po.BasePo;
import com.example.core.service.BaseService;
import com.example.sys.job.po.SysJob;
import com.example.sys.job.vo.SysJobVo;
import org.quartz.Job;
import org.quartz.JobExecutionException;

import java.util.Date;

public interface SysJobService extends BaseService<SysJob, SysJobVo> {

    public static final String JOB_GROUP_KEY = "com.example.job.group.key";

    public static final String JOBID = "JOBID";

    public static final String JOBNAME = "JOBNAME";

    public static final String MODELID = "MODELID";

    public static final String MODELNAME = "MODELNAME";

    public static final String JOBCLASS = "JOBCLASS";

    public void runOnce(Long id) throws Exception;

    public Date addJob(SysJob job) throws Exception;

    public void pauseJob(SysJob job) throws Exception;

    public void resumeJob(SysJob job) throws Exception;

    public void modifyJob(SysJob job) throws Exception;

    public void modifyJob(SysJobVo sysJobVo) throws Exception;

    public Date getNextTime(Date startTime, String cron) throws Exception;

    public SysJob getByJobClass(String jobClass) throws Exception;

    public String createCronExpression(Date date);

    public String createCronExpression(int minute);

    public void createUserJob(Class<? extends Job> jobClass, BasePo po, Date runTime) throws Exception;

    public void modifyUserJob(BasePo po, Date newTime) throws Exception;

    public void deleteUserJob(String id) throws Exception;
}
